<include file="public+header">

{script}
<!--
function add(){

	Dyhb.AjaxSubmit('applicationAdd','{:G::U('application/insert')}','',complete);
}
function update(){

	Dyhb.AjaxSubmit('applicationAdd','{:G::U('application/update')}');
}
function complete(data,status){

    if(status==1){

        $('#id').val(data.id);
    }
}

-->
{/script}

   <!-- 标题  -->
   <div class="title"><if condition="empty( $nId )" ><lang>添加应用</lang><else/><lang>编辑应用</lang></if> ( <a href="{:G::U('application/index')}"><lang>返回应用列表</lang></a> )</div>

  <!-- 正文 -->
  <div id="content" class="content">
      <form action="<if condition="empty( $nId )" >{:G::U('application/insert')}<else/>{:G::U('application/update')}</if>" method="post" id="applicationAdd">
      <table class="form-table full">
          <tr>
            <th valign="top"><label for="application_name"><lang>应用名称</lang>:</label></th>
            <td><input type="text" name="application_name" id="application_name" class="field" size="40"  value="<if condition="isset( $arrValue )">{$arrValue['application_name']}</if>"/>
	             <div class="description"><lang>限 20 字节。</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="application_url"><lang>应用的 URL</lang>:</label></th>
            <td><input type="text" name="application_url" id="application_url" class="field" size="40"  value="<if condition="isset( $arrValue )">{$arrValue['application_url']}</if>"/>
            <div class="description"><lang>该应用与 UCenter 通信的接口 URL，结尾请不要加\"/\"</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="application_ip"><lang>应用 IP</lang>:</label></th>
            <td><input type="text" name="application_ip" id="application_ip" class="field" size="40"  value="<if condition="isset( $arrValue )">{$arrValue['application_ip']}</if>"/>
            <div class="description"><lang>正常情况下留空即可。如果由于域名解析问题导致 UCenter 与该应用通信失败，请尝试设置为该应用所在服务器的 IP 地址。</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="application_authkey"><lang>通信密钥</lang>:</label></th>
            <td><input type="text" name="application_authkey" id="application_authkey" class="field" size="40" value="<if condition="isset( $arrValue )">{$arrValue['application_authkey']}</if>"/>
            <div class="description"><lang>只允许使用英文字母及数字，限 64 字节。应用端的通信密钥必须与此设置保持一致，否则该应用将无法与 UCenter 正常通信。</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="application_type"><lang>应用类型</lang>:</label></th>
            <td><select name="application_type">
					{foreach $arrTypeList  $sTypeId  $sTypeName}
					<option value="{$sTypeId}" {if !empty( $arrValue['application_type'] ) && $sTypeId==$arrValue['application_type']}{/if}> {$sTypeName} </option>
					{/foreach}
				</select>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="apppath"><lang>应用的物理路径</lang>:</label></th>
            <td><input type="text" name="apppath" id="apppath" class="field" size="40" value="{$sAppPath}"/>
	           <div class="description"><lang>默认请留空，如果填写的为相对路径（相对于UC），程序会自动转换为绝对路径，如 ../</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="application_viewprourl"><lang>查看个人资料页面地址</lang>:</label></th>
            <td><input type="text" name="application_viewprourl" id="application_viewprourl" class="field" size="40"  value="<if condition="isset( $arrValue )">{$arrValue['application_viewprourl']}</if>"/>
            <div class="description"><lang>URL中域名后面的部分，如：/space.php?uid=%s 这里的 %s 代表uid</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="application_apifilename"><lang>应用接口文件名称</lang>:</label></th>
            <td><input type="text" name="application_apifilename" id="application_apifilename" class="field" size="40"  value="<if condition="isset( $arrValue )">{$arrValue['application_apifilename']}</if>"/>
            <div class="description"><lang>应用接口文件名称，不含路径，默认为Uc.php</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="application_tagtemplates"><lang>标签单条显示模板</lang>:</label></th>
            <td><textarea name="application_tagtemplates" id="application_tagtemplates" class="field" cols="70" rows="5"><if condition="isset( $arrTagTemplates['template'] )">{$arrTagTemplates['template']}</if></textarea>
            <div class="description"><lang>当前应用的标签数据显示在其它应用时的单条数据模板。</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="tagfields"><lang>标签模板标记说明</lang>:</label></th>
            <td><textarea name="tagfields" id="tagfields" class="field" cols="70" rows="5"><if condition="isset( $arrTagTemplates['fields'] )">{$arrTagTemplates['fields']}</if></textarea>
            <div class="description"><lang>一行一个标记说明条目，用逗号分割标记和说明文字。如：</lang><br /><lang>subject,主题标题</lang><br /><lang>url,主题地址</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="application_synlogin"><lang>是否开启同步登录</lang>:</label></th>
            <td><input type="radio" class="field" id="application_synlogin" name="application_synlogin" value="1" <if condition="isset( $arrValue ) && $arrValue['application_synlogin']==1">checked="checked"</if> /><lang>是</lang>
				<input type="radio" class="field" id="" name="application_synlogin" value="0" <if condition="!isset( $arrValue ) || ( isset( $arrValue ) && $arrValue['application_synlogin'] eq 0 ) ">checked="checked"</if> /><lang>否</lang>
	           <div class="description"><lang>开启同步登录后，当用户在登录其他应用时，同时也会登录该应用。</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="application_recvnote"><lang>是否接受通知</lang>:</label></th>
            <td><input type="radio" class="field" id="application_recvnote" name="application_recvnote" value="1" <if condition="isset( $arrValue ) && $arrValue['application_recvnote']==1">checked="checked"</if> /><lang>是</lang>
				<input type="radio" class="field" id="" name="application_recvnote" value="0" <if condition="!isset( $arrValue ) || ( isset( $arrValue ) && $arrValue['application_recvnote'] eq 0 ) ">checked="checked"</if> /><lang>否</lang>
	           <div class="description"><lang>默认请留空，如果填写的为相对路径（相对于UC），程序会自动转换为绝对路径，如 ../</lang></div>
            </td>
          </tr>

          </table>
          <p class="center"><input type="hidden" name="ajax" value="1">
          <input type="hidden" name="id" id="id" value="<if condition="isset( $nId )">{$nId}</if>"/>
          <input type="button" onclick="<if condition="!empty( $nId )" >update()<else/>add()</if>"  class="button" value="<if condition="!empty( $nId )" >  <lang>更  新</lang><else/>  <lang>发  布</lang></if>  " />
          <input type="reset" class="button" value="  <lang>重  置</lang>  " />
        </p>
        </form>
		<if condition="!empty( $nId )" >
        <br>
        <table class="form-table full">
          <tr>
            <th valign="top"><label for="application_name"><lang>应用的 UCenter 配置信息</lang>:</label></th>
            <td>
<textarea name="application_tagtemplates" id="application_tagtemplates" class="field" cols="70" rows="10" onFocus="this.select()">
define('UC_CONNECT', '{:G::C('DB_TYPE')}');
define('UC_DBHOST', '{:G::C('DB_HOST')}');
define('UC_DBUSER', '{:G::C('DB_USER')}');
define('UC_DBPW', '{:G::C('DB_PASSWORD')}');
define('UC_DBNAME', '{:G::C('DB_NAME')}');
define('UC_DBCHARSET', '{:G::C('DB_CHAR')}');
define('UC_DBTABLEPRE', '{:G::C('DB_PREFIX')}');
define('UC_DBCONNECT', '0');
define('UC_KEY', '<if condition="isset( $arrValue )">{$arrValue['application_authkey']}</if>');
define('UC_API', '{:UC_API}');
define('UC_CHARSET', '{:UC_CHARSET}');
define('UC_IP', '<if condition="isset( $arrValue )">{$arrValue['application_ip']}</if>');
define('UC_APPID', '<if condition="isset( $arrValue )">{$arrValue['application_id']}</if>');
define('UC_PPP', '20');
			</textarea>
	             <div class="description"><lang>当应用的 UCenter 配置信息丢失时可复制左侧的代码到应用的配置文件中。</lang></div>
				 <div class="warning"><lang>一般不需要</lang></div>
            </td>
          </tr>
	   </table>
       </if>

   </div>
   <!-- end content -->

<include file="public+footer">